<table class="teachers_table" cellspacing="0" cellpadding="0">
    <thead>
        <tr>
            <th><?php echo __('No.')?></th>
            <th><?php echo __('Teacher Name')?></th>
            <th><?php echo __('Phone')?></th>
            <th><?php echo __('Programs attented')?></th>
            <th><?php echo __('Actions')?></th>
        </tr>
    </thead>
    <tbody>
        <?php 
        $i = 0;
        foreach($teachers as $teacher){?>
        <tr class="<?php echo $i%2==1?'odd':'even'?>">
            <td><?php echo ++$i ?></td>
            <td>
                <?php echo $teacher?>
                <br/>
                 [<a class="card_link" href="#" onclick="window.open('<?php echo url_for('teacher/card?id='.$teacher['intg_identity'])?>', 'teacherWindow', 'width=600,height=600,scrollbars=true')"><?php echo __('Teacher card')?></a>]                
            </td>
            <td><?php 
            $phone = $teacher->getPhone();
            echo !empty($phone)?$teacher->getPhone():__('N.A')?></td>
            <td>
                <?php $programs = $teacher->getPrograms(LinkTeacherProgramTable::STATUS_APPROVED, array('created_at','desc'), 3);?>
                <?php if(count($programs)){?>
                <ul>
                    <?php foreach($programs as $p){?>
                        <li>
                            <?php echo $p; ?>
                            [<a class="card_link" href="#" onclick="window.open('<?php echo url_for('program/card?id='.$p['id'])?>', 'programWindow', 'width=600,height=600,scrollbars=true')"><?php echo __('Program card')?></a>]
                        </li>
                    <?php }?>
                </ul>
                <?php }else{?>
                <h2 class="no_data"><?php echo __('No programs attended')?></h2>
                <?php }?>
            </td>
            <td>
                <?php if($teacher->getIsHanged()){?>
                    <?php if($teacher->getHangeStatus() == TeacherTable::HANG_STATUS_APPROVED){?>
                        <?php echo __('Hanging Approved')?><br/>
                        <?php echo link_to(__('Stop hanging'), 'teacher/changeHanging?teacher_id='.$teacher->getPrimaryKey().'&status='.TeacherTable::HANG_STATUS_REQUEST_STOP_HANGING)?>
                    <?php }elseif($teacher->getHangeStatus() == TeacherTable::HANG_STATUS_PENDING){?>
                        <?php echo __('Hanging not approved')?><br/>
                        <?php echo link_to(__('Cancel hanging Request'), 'teacher/changeHanging?teacher_id='.$teacher->getPrimaryKey().'&status='.TeacherTable::HANG_STATUS_CANCELED)?>
                    <?php }?>
                <?php }else{?>
                        <?php echo link_to(__('Hang'), 'teacher/hang?teacher_id='.$teacher->getPrimaryKey())?>
                <?php }?>    
            </td>
        </tr>
        <?php }?>
    </tbody>
</table>    

